package com.bohua.child.entity;

import lombok.Builder;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Date;
import java.io.Serializable;
/**
 * 用户表
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/02/19
 */
@Data
public class User implements Serializable, UserDetails {
        /**
         * 主键 编号
         */
        private Integer id;
        /**
         * 用户名字
         */
        private String name;
        /**
         * 用户密码
         */
        private String password;
        /**
         * 0 禁用 1 可用 （是否已过期）
         */
        private boolean state;
        /**
         * 0 学生 1 家长 2 老师 3 院长
         */
        private boolean roleAuthority;
        /**
         * 用户是否被锁定或者被解锁
         */
        private boolean accountnonlocked;
        /**
         * 指定已过期的用户来验证
         */
        private boolean credentialsnonexpired;
        /**
         * 是否被禁用
         */
        private boolean enabled;

        @Override
        public Collection<? extends GrantedAuthority> getAuthorities() {
                return null;
        }

        @Override
        public String getPassword() {
                return password;
        }

        @Override
        public String getUsername() {
                return name;
        }

        @Override
        public boolean isAccountNonExpired() {
                return state;
        }

        @Override
        public boolean isAccountNonLocked() {
                return accountnonlocked;
        }

        @Override
        public boolean isCredentialsNonExpired() {
                return credentialsnonexpired;
        }

        @Override
        public boolean isEnabled() {
                return enabled;
        }
}
